<div class="box">
    <div class="heading">
      <h1><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/book.png" alt="" />Management Ads</h1>
      <div class="buttons">
        <?php echo CHtml::link('Insert',array('ads/create'),array('class'=>'button')); ?>
          <a onclick="confirm('Are you sure you want to delete this book?')" class="button">Delete</a>
      </div>
    </div>
    <div class="content">
      <form action="delete" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr>
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);"></td>
              <td class="left">Ads's ID</td>
              <td class="left">Ads's Title</td>
              <td class="left">Ads's Begin Date</td>
              <td class="left">Ads's Duration</td>
              <td class="left">Customer's name</td>
              <td class="center">Action</td>
            </tr>
          </thead>
          <tbody>
            <tr class="search">
              <td></td>
              <td><input type="text" name="search_idbook" value=""></td>
              <td><input type="text" name="search_title" value=""></td>
              <td><input type="text" name="search_author" value=""></td>
              <td><input type="text" name="search_view" value=""></td>
              <td><input type="text" name="search_view" value=""></td>
              <td align="center"><a onclick="search();" class="button">Search</a></td>
            </tr>
            
            <?php foreach($ads as $ad){ ?>
            <tr>
              <td style="text-align: center;">
                <input type="checkbox" name="selected[]" value="book_id" />
              </td>
              <td class="left"><?php echo $ad->ads_id?></td>
              <td class="left"><?php echo $ad->ads_title?></td>
              <td class="left"><?php echo date('d-m-y H:i',  strtotime($ad->ads_begindate))?></td>
              <td class="left"><?php echo $ad->ads_duration?></td>
              <td class="left"><?php echo $ad->ads_customer_name?></td>
              <td class="center">
                  <?php echo CHtml::link('View', array('ads/view', 'id'=> $ad->ads_id)); ?>|
                  <?php echo CHtml::link('Update', array('ads/update', 'id'=> $ad->ads_id)); ?>|
                  <?php echo CHtml::link('Delete',"#", array("submit"=>array('delete', 'id'=>$ad->ads_id), 'confirm' => 'Are you sure?')); ?>
              </td>
              </td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
    </div>
  </div>